#pragma once
#ifndef HTTP_H_INCLUDED
#define HTTP_H_INCLUDED
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <sys/epoll.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <dirent.h>
#include <sys/stat.h>
#include <ctype.h>
#define MAXSIZE 2000

#include "page.h"

int get_line(int sock, char *buf, int size);
const char* get_file_type(const char *name);
void disconnect(int cfd, int epfd);
void send_respond_head(int cfd, int no, const char* desp, const char* type, long len);
void send_file(int cfd, const char* filename);
void http_get_request(const char* request, int cfd, const char* root);
void http_post_request(const char* request, int cfd);
// 通过文件名获取文件的类型
const char* get_file_type(const char *name);
void do_read(int cfd, int epfd, const char *root);
void do_accept(int lfd, int epfd);
int init_listen_fd(int port, int epfd);
void run_epoll(int port,char* path, const char *root);

#endif
